package hu.debrecen.adastra.card.service.impl;

import hu.debrecen.adastra.card.service.BotPlayMode;
import hu.debrecen.adastra.card.service.domain.Card;
import hu.debrecen.adastra.card.web.domain.AbstractGameStateVO;
import hu.debrecen.adastra.card.web.domain.HandCardVO;

import com.google.common.base.Predicate;
import com.google.common.collect.Iterables;

public class DummyBotPlayMode implements BotPlayMode {

	@Override
	public Card evaluate(final AbstractGameStateVO gameState) {
		Iterable<HandCardVO> usableCard = Iterables.filter(gameState.getHand(), new Predicate<HandCardVO>() {

			@Override
			public boolean apply(final HandCardVO card) {
				return card.isUsable();
			}
		});

		return Iterables.getFirst(usableCard, null);
	}
}
